#include <opencv2\opencv.hpp>
using namespace cv;
int main()
{
	Mat img = imread("threshold.jpg",0);
	Mat thresh1, thresh2, thresh3, thresh4, thresh5;
	
	threshold(img, thresh1, 127, 255, THRESH_BINARY);
	threshold(img, thresh2, 127, 255, THRESH_BINARY_INV);
	threshold(img, thresh3, 127, 255, THRESH_TRUNC);
	threshold(img, thresh4, 127, 255, THRESH_TOZERO);
	threshold(img, thresh5, 127, 255, THRESH_TOZERO_INV);

	imshow("Original Image", img);
	imshow("BINARY", thresh1);
	imshow("BINARY_INV", thresh2);
	imshow("TRUNC", thresh3);
	imshow("TOZERO", thresh4);
	imshow("TOZERO_INV", thresh5);
	waitKey(0);
	return 0;
}